package com.huike.clues.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huike.clues.domain.SysNotice;
import com.huike.clues.mapper.MpNoticeMapper;
import com.huike.clues.service.MpNoticeService;
import com.huike.common.entity.MPSysNotice;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * @Description TODO
 * @Author guan
 * @Date 2023-08-30 11:12
 */
@Service
public class MpNoticeServiceImpl extends ServiceImpl<MpNoticeMapper,MPSysNotice> implements MpNoticeService {

    @Resource
    private MpNoticeMapper mpNoticeMapper;

    /**
     * 获取系统提醒分页列表
     * @param
     * @return
     */
    @Override
    public List<MPSysNotice> selectNoticeList(Long noticeUserId, String status)
    {
        return mpNoticeMapper.selectNoticeList(noticeUserId,status);
    }

    /**
     * 获取系统提醒下拉列表
     * @return
     */
    @Override
    public List<MPSysNotice> getListStatus(String status) {
        LambdaQueryWrapper<MPSysNotice> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MPSysNotice::getStatus,status);
        List<MPSysNotice> sysNoticeList = mpNoticeMapper.selectList(queryWrapper);
        return sysNoticeList;
    }

    /**
     * 获取详情信息接口
     * @param noticeId
     * @return
     */
    @Override
    public MPSysNotice getNoticeId(Integer noticeId) {
        LambdaQueryWrapper<MPSysNotice> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MPSysNotice::getStatus,noticeId);
        MPSysNotice mpSysNotice = mpNoticeMapper.selectOne(queryWrapper);
        return mpSysNotice;
    }

    @Override
    public void updateNoticeId(Integer noticeId) {
        MPSysNotice mpSysNotice = new MPSysNotice();
        mpSysNotice.setNoticeId(noticeId);
        mpSysNotice.setStatus("1");
        mpNoticeMapper.updateById(mpSysNotice);

    }
}
